package fr.mystnihon.game;

import java.lang.ref.WeakReference;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import fr.mystnihon.game.context.ViewContext;
import fr.mystnihon.game.context.WorldContext;

public final class GameApplication extends Application {

	public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
	public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
	public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
	public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;
	public static final boolean DEVELOPMENT_VALIDATEDATA = false;
	public static final boolean DEVELOPMENT_DEBUGMESSAGES = false;
	public static final int CURRENT_VERSION = 25;
	public static final String CURRENT_VERSION_DISPLAY = "0.6.11dev";

	public final WorldContext world = new WorldContext();
	public final WorldSetup setup = new WorldSetup(world, this);
	public WeakReference<ViewContext> currentView;

	// public final AndorsTrailPreferences preferences = new
	// AndorsTrailPreferences();

	public static GameApplication getApplicationFromActivity(
			Activity activity) {
		return ((GameApplication) activity.getApplication());
	}

	public static GameApplication getApplicationFromActivityContext(
			Context context) {
		return getApplicationFromActivity(getActivityFromActivityContext(context));
	}

	public static Activity getActivityFromActivityContext(Context context) {
		return (Activity) context;
	}

	// public static void setWindowParameters(Activity activity,
	// final AndorsTrailPreferences preferences) {
	// activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
	// if (preferences.fullscreen) {
	// activity.getWindow().setFlags(
	// WindowManager.LayoutParams.FLAG_FULLSCREEN,
	// WindowManager.LayoutParams.FLAG_FULLSCREEN);
	// } else {
	// activity.getWindow().setFlags(0,
	// WindowManager.LayoutParams.FLAG_FULLSCREEN);
	// }
	// }
}
